package com.suxin.thread.manager.threadpool;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author Tang
 * @classname GlobalExecutor
 * @description [ 全局的线程池创建 ]
 * @date 2022/8/11 16:20
 */
public class GlobalExecutor {

    private static final int THREAD_COUNT = Runtime.getRuntime().availableProcessors();

    private static final ScheduledExecutorService HEARTBEAT_EXECUTOR =
            ExecutorFactory.Managed.newScheduledExecutorService("groupName",2, new NameThreadFactory("heart")) ;

    public static void submitHeartbeat(Runnable runnable,long time) {
        HEARTBEAT_EXECUTOR.schedule(runnable, time, TimeUnit.SECONDS);
    }

}